﻿using System.ComponentModel.DataAnnotations;

namespace OrderApi.DTOs
{
    /// <summary>
    /// 订单查询参数
    /// </summary>
    public class OrderQueryParameters
    {
        /// <summary>
        /// 订单编号（必填）
        /// </summary>
        /// <example>ORD-2024</example>
        [Required(ErrorMessage = "订单编号是必填项")]
        public string OrderNumber { get; set; } = null!;

        /// <summary>
        /// 客户名称（可选）
        /// </summary>
        /// <example>张</example>
        [MaxLength(100, ErrorMessage = "客户名称长度不能超过100个字符")]
        public string? CustomerName { get; set; }

        /// <summary>
        /// 订单状态（可选）
        /// </summary>
        /// <example>Created</example>
        [MaxLength(20, ErrorMessage = "订单状态长度不能超过20个字符")]
        public string? Status { get; set; }

        /// <summary>
        /// 最小金额（可选）
        /// </summary>
        /// <example>100</example>
        [Range(0, double.MaxValue, ErrorMessage = "最小金额不能小于0")]
        public decimal? MinAmount { get; set; }

        /// <summary>
        /// 最大金额（可选）
        /// </summary>
        /// <example>1000</example>
        [Range(0, double.MaxValue, ErrorMessage = "最大金额不能小于0")]
        public decimal? MaxAmount { get; set; }

        /// <summary>
        /// 开始日期（可选）
        /// </summary>
        /// <example>2024-05-01</example>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期（可选）
        /// </summary>
        /// <example>2024-05-31</example>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 页码（默认1）
        /// </summary>
        /// <example>1</example>
        [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")]
        public int Page { get; set; } = 1;

        /// <summary>
        /// 每页数量（默认10）
        /// </summary>
        /// <example>10</example>
        [Range(1, 100, ErrorMessage = "每页数量必须在1-100之间")]
        public int PageSize { get; set; } = 10;
    }
}